package pers.gxm.visitor;

public class FileTreatmentException extends RuntimeException{
    public FileTreatmentException(){}
    public FileTreatmentException(String msg){
        super(msg);
    }

    public static void main(String[] args) {
        Directory root = new Directory("root");
        Directory bin = new Directory("bin");
        Directory tmp = new Directory("tmp");
        Directory usr = new Directory("usr");
        root.add(bin);
        root.add(tmp);
        root.add(usr);
        bin.add(new File("vi",10000));
        bin.add(new File("latex",20000));
        root.accept(new ListVisitor());
        System.out.println("==============分割线========");
        Directory yuki = new Directory("yuki");
        Directory hanako = new Directory("hanako");
        Directory tomura = new Directory("tomura");
        usr.add(yuki);
        usr.add(hanako);
        usr.add(tomura);
        yuki.add(new File("diary.html",100));
        yuki.add(new File("Composite.java",200));
        hanako.add(new File("memo.txt",300));
        tomura.add(new File("game.doc",400));
        tomura.add(new File("junk.mail",500));
        root.accept(new ListVisitor());
    }
}
